package com.learn.xueer.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.learn.xueer.R
import com.learn.xueer.data.model.bean.PramsJson

class PriceAdapter(data: MutableList<PramsJson>, var select: Int) :
    BaseQuickAdapter<PramsJson, BaseViewHolder>(
        R.layout.item_price, data
    ) {

    override fun convert(holder: BaseViewHolder, item: PramsJson) {
        if (select == holder.layoutPosition) {
            holder.setBackgroundResource(R.id.lin_item, R.drawable.rec_e8fdf4)
            holder.setBackgroundResource(R.id.line, R.drawable.dash_0cb76c)
            holder.setTextColor(R.id.tv_month, context.resources.getColor(R.color._0cb76c))
            holder.setTextColor(R.id.tv_price, context.resources.getColor(R.color._0cb76c))
        } else {
            holder.setBackgroundResource(R.id.lin_item, R.drawable.rec_e5_f5)
            holder.setTextColor(R.id.tv_month, context.resources.getColor(R.color._8e8e8e))
            holder.setTextColor(R.id.tv_price, context.resources.getColor(R.color._333333))
            holder.setBackgroundResource(R.id.line, R.drawable.dash_e5e5e5)
        }
        holder.setText(R.id.tv_month, "${item.mouth}个月")
        holder.setText(R.id.tv_price, "￥${item.price}")


    }
}